package me.wz.util.sdbc.spring;

import me.wz.util.sdbc.ISdbc;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;

@Configuration
@ConditionalOnClass({NamedParameterJdbcTemplate.class, Sdbc.class})
public class SdbcAutoConfiguration {
    @Bean
    @ConditionalOnMissingBean(Sdbc.class)
    public ISdbc sdbc(NamedParameterJdbcTemplate jdbcTemplate){
        Sdbc jdbc = new Sdbc();
        jdbc.setJdbc(jdbcTemplate);
        return jdbc;
    }
}
